package com.JavaNet.chapter04_INetAddress;

import java.net.*;

public class OReillyByName {

    public static void main(String[] args) {
        String host = "www.oreilly.com";
        try {
            InetAddress address = InetAddress.getByName(host);  //通过 域名获取 IP 地址 ;
            System.out.println("INFO  address ==>  "  +  address);
            InetAddress[] inetAddresses = InetAddress.getAllByName(host);

            for (InetAddress inetAddress : inetAddresses) {
                System.out.println("INFO  inetAddress  ==>  "  +  inetAddress);

            }

        } catch (UnknownHostException ex) {
            System.out.println("ERROR Could not find www.oreilly.com "  + ex.getMessage());
        }
    }
}
